package cn.tedu.admin.companyandjob.service.impl;

import cn.tedu.admin.companyandjob.dao.persist.repository.IJobRepository;
import cn.tedu.admin.companyandjob.pojo.entity.JobDetail;
import cn.tedu.admin.companyandjob.pojo.param.JobParam;
import cn.tedu.admin.companyandjob.pojo.vo.JobListItemVO;
import cn.tedu.admin.companyandjob.service.IJobService;
import cn.tedu.common.pojo.vo.PageData;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class JobServiceImpl implements IJobService {
    @Autowired
    IJobRepository iJobRepository;

    @Override
    public PageData<JobListItemVO> selectJobList(Integer pageNum) {
        return iJobRepository.selectJobList(pageNum,10);
    }

    @Override
    public void updataJob(Long jobId, JobParam jobParam) {
        JobDetail jobDetail = new JobDetail();
        BeanUtils.copyProperties(jobParam,jobDetail);
        jobDetail.setId(jobId);
        iJobRepository.updataJob(jobDetail);
    }

    @Override
    public void deleteJob(Long jobId) {
        iJobRepository.deleteJob(jobId);
    }
}
